package mms.farina.thecell.messages;

import java.io.Serializable;

/**Classe per la gestione dei messaggi complessi*/
public class CustomMessage extends SimpleMessage implements Serializable {
	
	/**
	 * Tipologie di messaggio utilzzate
	 */
	public static String MESSAGE_TYPE_POLL="POLL"; /**Poll verso il server*/
	public static String MESSAGE_TYPE_POLLRESPONSE="POLLRESPONSE"; /**Poll dal server*/
	public static String MESSAGE_TYPE_ALERT="ALERT"; /**Allerta*/
	public static String MESSAGE_TYPE_MEX="MEX";/**Messaggio unicast e broadcast*/
	public static String MESSAGE_TYPE_MEXACK="MEXACK";/**Ack Messaggio unicast e broadcast*/
	public static String MESSAGE_TYPE_GEOINFO="GEO"; /**Messaggio con informazioni di geolocalizzazione*/
	public static String MESSAGE_TYPE_GEOINFOPLUS="GEOPLUS";/**Messaggio con informazioni di geolocalizzazione + ip e porta dell'utente*/
	/**Messaggi di autenticazione*/
	public static String MESSAGE_TYPE_ATUHREQ="ATUHREQ"; 
	public static String MESSAGE_TYPE_ATUHREQ2="ATUHREQ2";
	public static String MESSAGE_TYPE_ATUHREQ3="ATUHREQ3";
	public static String MESSAGE_TYPE_ATUHRES="ATUHRES";
	public static String MESSAGE_TYPE_ATUHRES2="ATUHRES2";
	public static String MESSAGE_TYPE_ATUHRES3="ATUHRES3";
	
	private static final long serialVersionUID = 645091318571753520L;
	
	/**Campi eventualmente presenti nei messaggi*/
	private String to_nick=""; /**Nickname del destinatario*/
	private double longitude=0; /**Longitudine*/
	private double latitude=0; /**Latitudine*/
	private String textMessage=""; /**Messaggio di testo*/
	private String neighbour_ip="";/**Ip del vicino*/
	private int neighbour_port=0;/**Porta del vicino*/


	
	public CustomMessage(String type) {
		super();
		super.setType(type);
	}
	
	public CustomMessage(String type, String ip, int port, String sip, int sport) {
		super();
		this.setType(type);
		this.setNeighbour_ip(ip);
		this.setNeighbour_port(port);
		this.setSender_ip(sip);
		this.setSender_port(sport);
		
	}
	
	public CustomMessage(String type, String nick) {
		super();
		super.setType(type);
		super.setSender_nick(nick);
	}
	
	public CustomMessage(String type, String ip, int port) {
		super();
		super.setType(type);
		setNeighbour_ip(ip);
		setNeighbour_port(port);
	}

	
	public CustomMessage(String type, String nick, String message) {
		super(type);
		super.setSender_nick(nick);
		this.setTextMessage(message);
	}
	
	public CustomMessage(String type, String nick, String tonick, String message) {
		super(type);
		this.setSender_nick(nick);
		this.setTo_nick(tonick);
		this.setTextMessage(message);
	}
	

	
	public CustomMessage(String type, String nick, double longitude, double latitude) {
		super(type);
		this.setSender_nick(nick);
		this.setLongitude(longitude);
		this.setLatitude(latitude);
	}
	
	public CustomMessage(String type, String nick, double latitude, double longitude, String ip, int port) {
		super(type);
		this.setSender_nick(nick);
		this.setLongitude(longitude);
		this.setLatitude(latitude);
		this.setSender_ip(ip);
		this.setSender_port(port);
	}


	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public String getTextMessage() {
		return textMessage;
	}

	public void setTextMessage(String textMessage) {
		this.textMessage = textMessage;
	}

	public String getTo_nick() {
		return to_nick;
	}

	public void setTo_nick(String to_nick) {
		this.to_nick = to_nick;
	}
	
	public String getType() {
		return super.getType();
	}

	public void setType(String type) {
		super.setType(type);
	}


	public String getSender_nick() {
		return super.getSender_nick();
	}

	public void setSender_nick(String sender_nick) {
		super.setSender_nick(sender_nick);
	}

	public String getNeighbour_ip() {
		return neighbour_ip;
	}

	public void setNeighbour_ip(String neighbour_ip) {
		this.neighbour_ip = neighbour_ip;
	}

	public int getNeighbour_port() {
		return neighbour_port;
	}

	public void setNeighbour_port(int neighbour_port) {
		this.neighbour_port = neighbour_port;
	}
	
	public String getSender_ip() {
		return super.getSender_ip();
	}

	public void setSender_ip(String sender_ip) {
		super.setSender_ip(sender_ip);
	}

	public int getSender_port() {
		return super.getSender_port();
	}

	public void setSender_port(int sender_port) {
		super.setSender_port(sender_port);
	}

}
